#include <length.h>
#ifdef strType

#ifndef INCLUDING_MODEL_MOUNTSTREAM_IO
#define INCLUDING_MODEL_MOUNTSTREAM_IO

#define _STRFUNC(funcName)              funcName
#define STRFUNC(funcName) 	        _STRFUNC(funcName)

#include <BasicMatic.h>
#include <structure.h>
//Edit Stream func
#define _MOUNT_(x,y)   _MountStream_INT(x,y)
#define _UNMOUNT_(x,y) _UnmountStream_INT(x,y)
#define _NAME(x,y)     _NameStream_INT(x,y)

#define _MountStream_INT(stream,root)		\
  _MOUNT(&((stream)->container),&((root)->container))

#define _UnmountStream_INT(stream,root)			\
  _UNMOUNT(&((stream)->container),&((root)->container))


//_NameStream_INT is not defined.
#define _NameStream_INT(streanName,stream)  \
  

template<typename A,typename B>
_ptlong STRFUNC(MountStream)(A stream,B root)
{
  return _MOUNT_(stream,root);
}

template<typename A,typename B>
_ptlong STRFUNC(UnmountStream)(A stream,B root)
{
  return _UNMOUNT_(stream,root);
}


_ptlong STRFUNC(MountStream)(strType stream, strType root)  
{    
  int re;
  return ((re = _MountStream(stream,(strType)root))==1?_MountStream_INT(stream,(strType)root):re);
;
}

_ptlong STRFUNC(UnmountStream)(strType stream,strType root)  
{
  int re;
  return ((re = _UnmountStream(stream,(strType)root))==1?_UnmountStream_INT(stream,(strType)root):re);
}

_ptlong STRFUNC(NameStream)(char* streamName, strType stream)
{
  int re;
  return ((re = _NamStream(streamName,stream))==1?_NamStream_INT(streamName,stream):re);
;

}



//Non-Edit Stream func
////Maybe be canceled -- for the kernel is read only, we can give the head file, and the user can just read the tree information
#define _FindStream_INT(streamName/*char*/,root)  \
  _FIND(streamName,&(root->container),__COMPARE)

#define __COMPARE(streamName,obj)  StrCompare(streamName,obj->name)

#define _NextStream_INT(root)  \
  _NEXT(&(root->container));

#define _BesideStream_INT(root)  \
  _BESIDE(&(root->container));

strType STRFUNC(FindStream)(char* streamName, strType root)
{
  return _FindStream_INT(streanName,root);
  //  _FindStream(streamName,root);
}

strType STRFUNC(NextStream)(strType root)
{
  return _NextStream_INT(root);
}

strType STRFUNC(BesideStream)(strType root)
{
  return _BesideStream_INT(root);
}

#endif

#endif
